#include "stdafx.h"
#include "GameDBProxySession.h"
#include "PacketHandler.h"
#include <PacketStruct.h>
#include "GameServer.h"
#include "ServerSessionFactory.h"
#include "ServerSessionManager.h"

GameDBProxySession::GameDBProxySession()
{
}

GameDBProxySession::~GameDBProxySession()
{
}

VOID GameDBProxySession::Init()
{
	ServerSession::Init();
}

VOID GameDBProxySession::Release()
{
	ServerSession::Release();
}

VOID GameDBProxySession::Update()
{
	ServerSession::Update();
}

VOID GameDBProxySession::OnConnect( BOOL bSuccess, DWORD dwSessionIndex )
{
	ServerSession::OnConnect( bSuccess, dwSessionIndex );

	if( bSuccess )
	{
		SUNLOG( eFULL_LOG,  "[GameDBProxySession::OnConnect] Connected to game DB proxy." );

		ServerSession::SendServerType();

		g_pGameServer->ConnectTo( AGENT_SERVER );
	}
	else
	{
		//SUNLOG( eFULL_LOG,  "Can't connect to game DB proxy." );
	}
}

VOID GameDBProxySession::OnDisconnect()
{
	printf( "Disconnected from game DB proxy." );

	ServerSession::OnDisconnect();
}

VOID GameDBProxySession::OnRecv( BYTE *pMsg, WORD wSize )
{
	PacketHandler::Instance()->ParsePacket_DG( this, (MSG_BASE *)pMsg, wSize );
}
